package com.bjpowernode.mvc.controller;


import cn.hutool.core.bean.BeanUtil;
import com.bjpowernode.mvc.model.result.CommonResult;
import com.bjpowernode.mvc.model.dto.AppDTO;
import com.bjpowernode.mvc.model.vo.AppVO;
import com.bjpowernode.mvc.service.inter.AppService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;



@RequiredArgsConstructor
@RestController
public class AppController {

    private final AppService appService;

    /**
     * 统计平台三项数据
     */
    @GetMapping(value = "/app/info")
    public  CommonResult getAppInfo(){
        AppDTO appDto = appService.getAppInfo();

        //使用糊涂工具库实现转换  copyProperties:将一个对象的属性值拷贝给另一个对象(同名属性)
        AppVO appVO = BeanUtil.copyProperties(appDto, AppVO.class);

        return CommonResult.ok(appVO);
    }
}
